package Cajero.Interfaz;

import java.text.SimpleDateFormat;
import java.util.Date;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author yailebs
 */
public class RegistrarCliente extends javax.swing.JFrame {

    /**
     * Creates new form RegistrarCliente
     */
    public RegistrarCliente() {
        initComponents();
        this.setLocationRelativeTo(null);
        this.setVisible(true);
        this.setResizable(false);
    }
    
    void SetControlador(ControladorCajero control){
        btRegistrar.addActionListener(control);
        btCancelar.addActionListener(control);
    }
    
    //Asignar valores
    void setTextoDocumento(String documento){
        txDocumento.setText(documento);
    }
    
    //Obtener valores
    String getTipoDocumento(){
        return jcTipoDocumento.getSelectedItem().toString();
    }
    
    String getApellidos(){
        return txApellidos.getText();
    }
    
    String getNombres(){
        return txNombre.getText();
    }
    
    String getDireccion(){
        return txDireccion.getText();
    }
    
    String getEmail(){
        return txEmail.getText();
    }
    
    String getTelefono(){
        return txTelefono.getText();
    }
    String getDocumento(){
        return txDocumento.getText();
    }
    
   String getFechaNacimiento(){
       String formato = jDateChooser1.getDateFormatString();
       Date fecha = jDateChooser1.getDate();
       SimpleDateFormat sdf = new SimpleDateFormat(formato);
       String fechaSelec;
       try{
       fechaSelec=String.valueOf(sdf.format(fecha));
       }catch(NullPointerException e){
           fechaSelec="";
       }
      return fechaSelec;
    }

    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpTitulo = new javax.swing.JPanel();
        lbTituloVentana = new javax.swing.JLabel();
        jpFormulario = new javax.swing.JPanel();
        lbTipoDocumento = new javax.swing.JLabel();
        jcTipoDocumento = new javax.swing.JComboBox();
        lbDocumentoC = new javax.swing.JLabel();
        txDocumento = new javax.swing.JTextField();
        lbNombre = new javax.swing.JLabel();
        txNombre = new javax.swing.JTextField();
        lbApellidos = new javax.swing.JLabel();
        txApellidos = new javax.swing.JTextField();
        lbTelefono = new javax.swing.JLabel();
        lbDireccion = new javax.swing.JLabel();
        txDireccion = new javax.swing.JTextField();
        lbFechaNacimiento = new javax.swing.JLabel();
        lbEmail = new javax.swing.JLabel();
        txEmail = new javax.swing.JTextField();
        btRegistrar = new javax.swing.JButton();
        btCancelar = new javax.swing.JButton();
        txTelefono = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Registrar Cliente");
        setBackground(new java.awt.Color(17, 14, 12));
        setForeground(new java.awt.Color(41, 30, 30));

        jpTitulo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jpTitulo.setOpaque(false);

        lbTituloVentana.setFont(new java.awt.Font("URW Chancery L", 1, 36)); // NOI18N
        lbTituloVentana.setText("REGISTRAR CLIENTE");

        javax.swing.GroupLayout jpTituloLayout = new javax.swing.GroupLayout(jpTitulo);
        jpTitulo.setLayout(jpTituloLayout);
        jpTituloLayout.setHorizontalGroup(
            jpTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpTituloLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(lbTituloVentana)
                .addContainerGap(84, Short.MAX_VALUE))
        );
        jpTituloLayout.setVerticalGroup(
            jpTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpTituloLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addComponent(lbTituloVentana)
                .addContainerGap(44, Short.MAX_VALUE))
        );

        jpFormulario.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpFormulario.setOpaque(false);

        lbTipoDocumento.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbTipoDocumento.setText("Tipo de Documento:");

        jcTipoDocumento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CC", "TI", "CE" }));

        lbDocumentoC.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbDocumentoC.setText("Documento:");

        lbNombre.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbNombre.setText("Nombres:");

        lbApellidos.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbApellidos.setText("Apellidos:");

        lbTelefono.setFont(new java.awt.Font("Arial", 1, 15)); // NOI18N
        lbTelefono.setText("Telefono:");

        lbDireccion.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbDireccion.setText("Direccion:");

        lbFechaNacimiento.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbFechaNacimiento.setText("Fecha de Nacimento:");

        lbEmail.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        lbEmail.setText("E-mail.");

        btRegistrar.setText("Registrar");

        btCancelar.setText("Cancelar");

        javax.swing.GroupLayout jpFormularioLayout = new javax.swing.GroupLayout(jpFormulario);
        jpFormulario.setLayout(jpFormularioLayout);
        jpFormularioLayout.setHorizontalGroup(
            jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpFormularioLayout.createSequentialGroup()
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpFormularioLayout.createSequentialGroup()
                        .addGap(138, 138, 138)
                        .addComponent(btRegistrar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btCancelar))
                    .addGroup(jpFormularioLayout.createSequentialGroup()
                        .addGap(35, 35, 35)
                        .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jpFormularioLayout.createSequentialGroup()
                                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(lbNombre)
                                            .addComponent(lbDocumentoC)
                                            .addComponent(lbApellidos)
                                            .addComponent(lbTipoDocumento))
                                        .addGroup(jpFormularioLayout.createSequentialGroup()
                                            .addComponent(lbDireccion)
                                            .addGap(74, 74, 74)))
                                    .addComponent(lbTelefono))
                                .addGap(22, 22, 22)
                                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jpFormularioLayout.createSequentialGroup()
                                        .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(txApellidos, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE)
                                            .addComponent(txNombre)
                                            .addComponent(txDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jcTipoDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(0, 0, Short.MAX_VALUE))
                                    .addComponent(txDireccion)
                                    .addComponent(txTelefono)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpFormularioLayout.createSequentialGroup()
                                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lbEmail)
                                    .addComponent(lbFechaNacimiento))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        jpFormularioLayout.setVerticalGroup(
            jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpFormularioLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbTipoDocumento)
                    .addComponent(jcTipoDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbDocumentoC))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbNombre))
                .addGap(18, 18, 18)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbApellidos))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbTelefono)
                    .addComponent(txTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addComponent(lbFechaNacimiento)
                .addGap(14, 14, 14)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbEmail)
                    .addComponent(txEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addGroup(jpFormularioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btRegistrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jpTitulo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpFormulario, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jpTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4)
                .addComponent(jpFormulario, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents



    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCancelar;
    private javax.swing.JButton btRegistrar;
    private javax.swing.JComboBox jcTipoDocumento;
    private javax.swing.JPanel jpFormulario;
    private javax.swing.JPanel jpTitulo;
    private javax.swing.JLabel lbApellidos;
    private javax.swing.JLabel lbDireccion;
    private javax.swing.JLabel lbDocumentoC;
    private javax.swing.JLabel lbEmail;
    private javax.swing.JLabel lbFechaNacimiento;
    private javax.swing.JLabel lbNombre;
    private javax.swing.JLabel lbTelefono;
    private javax.swing.JLabel lbTipoDocumento;
    private javax.swing.JLabel lbTituloVentana;
    private javax.swing.JTextField txApellidos;
    private javax.swing.JTextField txDireccion;
    private javax.swing.JTextField txDocumento;
    private javax.swing.JTextField txEmail;
    private javax.swing.JTextField txNombre;
    private javax.swing.JTextField txTelefono;
    // End of variables declaration//GEN-END:variables
}
